﻿/*
Description:先锋批记录卡打印
Copyright (c) : 通力凯顿（北京）系统集成有限公司
Writer:zhunan
create Date:2021-10-14
*/
using System.Drawing;
using System.Data;
using System;
using BusinessRule.Business;
using System.Collections.Generic;
using BusinessRule.Common;

public partial class forms_Custom_YePian_Default : System.Web.UI.Page
{
    YPContainerBusiness obj = new YPContainerBusiness();
    YPCommonBusiness common = new YPCommonBusiness();

    public string strHtmlTable = "";
    int pageNum = 1;//页码
    int pageCount = 1;//总页数
    string mfgordername = "";//订单号
    string containerid = "";//批次id
    //关键过程控制记录
    DataTable dtSpecCheckPoints = new DataTable();
    //设备型号
    DataTable dtSpecResource = new DataTable();
    DataTable dtContainerStepAttributes;//批次工序属性信息 add zhunan 2022.1.19
    //public DataTable dtContainerStepCheckNotes;//批次工序检验备注信息
    public DataTable dtContainerSubInfo;//批次的子批次信息 add by zhangrj 2022-10-29
    //是否打印空流水卡
    bool isBlank = false;
    //每页最大行数
    const int MAX_ROW_COUNT = 31;
    //当前页行数
    int currentRowsCount = 0;
    //批量打印批次个数
    int containerCount = 1;

    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!IsPostBack)
        {
            string ContainerId = "", WorkflowId = "", IsBlank = "";
            if (Session["PrintInfo"] != null)
            {
                List<Dictionary<string, object>> list = Session["PrintInfo"] as List<Dictionary<string, object>>;
                containerCount = list.Count;
                Session.Remove("PrintInfo");
                Dictionary<string, object> param;
                foreach (var item in list)
                {
                    param = item as Dictionary<string, object>;
                    ContainerId = param["ContainerId"].ToString();
                    WorkflowId = param["WorkflowId"].ToString();
                    IsBlank = param["IsBlank"].ToString();

                    strHtmlTable += print(ContainerId, WorkflowId, IsBlank);
                }
            }
            else
            {
                ContainerId = Request["ContainerId"];
                WorkflowId = Request["WorkflowId"];
                IsBlank = Request["IsBlank"];

                strHtmlTable += print(ContainerId, WorkflowId, IsBlank);
            }
        }
    }

    #region 方法

    //打印流水卡
    private string print(string ContainerId, string WorkflowId, string IsBlank)
    {
        strHtmlTable = "";
        pageCount = 1;

        if (string.IsNullOrEmpty(ContainerId) || string.IsNullOrEmpty(WorkflowId) || string.IsNullOrEmpty(IsBlank))
        {
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myScript", "<script>alert('刷新无效，请关闭后重新打印');</script>");
            return "";
        }

        Dictionary<string, object> para = new Dictionary<string, object>();
        para["ContainerId"] = ContainerId;
        para["WorkflowId"] = WorkflowId;
        isBlank = IsBlank.ToLower() != "true" ? false : true;
        para["IsBlank"] = isBlank;

        //流水卡打印数据
        DataSet ds = new DataSet();
        try
        {
            ds = obj.GetContainerPrintInfo(para);
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myScript", "<script>alert('" + ex.Message + "');</script>");
            return "";
        }

        //批次主信息
        DataTable dtContainerMainInfo = ds.Tables["dtMain"];
        dtContainerMainInfo.Columns.Add("childContainerNo");//批次顺序号

        if (dtContainerMainInfo.Rows.Count == 0)
        {
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myScript", "<script>alert('查无批次！');</script>");
            return "";
        }

        //拼接批次顺序号
        if (ds.Tables["childContainer"].Rows.Count > 0)
        {
            string strChildContainerNo = "";
            foreach (DataRow dr in ds.Tables["childContainer"].Rows)
            {
                strChildContainerNo += dr["childContainerNo"].ToString() + ",";
            }
            strChildContainerNo = strChildContainerNo.Remove(strChildContainerNo.Length - 1, 1);
            dtContainerMainInfo.Rows[0]["childContainerNo"] = strChildContainerNo;
        }

        //关键过程控制记录
        dtSpecCheckPoints = ds.Tables["dtCheckItemList"];

        dtContainerStepAttributes = ds.Tables["dtContainerStepAttributes"];//批次工序属性信息 add zhunan 2022.1.19
        dtContainerSubInfo = ds.Tables["dtContainerSubInfo"];//批次的子工艺批次信息 add zhangrj 2022-10-29
        //dtContainerStepCheckNotes = ds.Tables["dtContainerStepCheckNotes"];//批次工序检验备注信息 add zhangrj 2022-04-24
        //批次工序列表
        DataTable dtSpecs = ds.Tables["dtContainerStep"];

        bool checkerNoEdit = true;//checkerNoEdit:检验员没有录入过实测值
        if (dtSpecCheckPoints.Rows.Count > 0)
        {
            checkerNoEdit = dtSpecCheckPoints.Select("containerstepworkreportid IS NOT NULL").Length == 0 ? true : false;
        }

        //关键过程序多人报工时，只在最后一行显示关键过程信息
        dtSpecs = common.MergeContainerStepWorkReport(dtSpecs, checkerNoEdit);

        //设备型号
        dtSpecResource = ds.Tables["specResource"];

        if (dtContainerMainInfo.Rows.Count > 0)
        {
            //条码显示订单号
            mfgordername = dtContainerMainInfo.Rows[0]["mfgordername"].ToString();
            //条码显示containerid
            containerid = dtContainerMainInfo.Rows[0]["containerid"].ToString();
        }

        //生成首页分页（1行）
        strHtmlTable += "<div class='pager'>第&nbsp;" + pageNum + "&nbsp;页，共&nbsp;1&nbsp;页</div>";

        //生成批次主信息（6行）
        strHtmlTable += SetTableMain(dtContainerMainInfo);

        //生成工序表头（2行）
        strHtmlTable += SetSpecTableTitle();

        //首页分页 + 批次主信息 + 工序表头 = 9行
        currentRowsCount = 9;

        #region 分页控制

        foreach (DataRow dr in dtSpecs.Rows)
        {
            if (pageNum == 1)
            {
                if (dr["isSpotCheck"].ToString() == "1")
                {
                    int processCount, designCount;
                    if (checkerNoEdit)
                    {
                        processCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '3'", dr["specid"].ToString())).Length;
                        designCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '4'", dr["specid"].ToString())).Length;
                    }
                    else
                    {
                        processCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '3' and containerstepworkreportid = '{1}'",
                            dr["specid"].ToString(), dr["reportid"].ToString())).Length;
                        designCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '4' and containerstepworkreportid = '{1}'",
                            dr["specid"].ToString(), dr["reportid"].ToString())).Length;
                    }

                    //设计参数至少显示1行，没有则显示空行
                    processCount = processCount == 0 ? 1 : processCount;
                    //过程参数至少显示1行，没有则显示空行
                    designCount = designCount == 0 ? 1 : designCount;

                    //MAX_ROW_COUNT - 2 ==> 总行数 - 预留给条码区的2行高度
                    if ((currentRowsCount + (7 + processCount + designCount)) <= (MAX_ROW_COUNT - 2))
                    {
                        //第1页放得下关键过程控制记录
                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        strHtmlTable += common.SetSpecKeyQualityControl(dr["specid"].ToString(), dr["reportid"].ToString(), checkerNoEdit, dtSpecCheckPoints, dtSpecResource, dr);
                        currentRowsCount += (7 + processCount + designCount);
                    }
                    else
                    {
                        //第1页放不下关键过程控制记录
                        //补充空行
                        for (int i = 0; i < (MAX_ROW_COUNT - currentRowsCount - 2); i++)
                        {
                            DataTable dt = dtSpecs.Clone();
                            strHtmlTable += SetSpecTableRow(dt.NewRow(), dtContainerMainInfo);
                        }

                        pageNum += 1;
                        pageCount += 1;

                        //分页之前添加首页底部条码（2行）
                        strHtmlTable += "<div class='code'><div class='containerid'>*" + containerid + "*</div><div class='mfgorder'>*" + mfgordername + "*</div></div>";
                        strHtmlTable += "<div style='width:700px;height:0px;margin-bottom:0px;PAGE-BREAK-AFTER:always;'></div>";

                        //下一页添加分页（1行）
                        strHtmlTable += "<div class='pager' style='border-bottom:1px solid blue;'>第&nbsp;" + pageNum + "&nbsp;页，共&nbsp;1&nbsp;页</div>";
                        currentRowsCount = 1;

                        //在下一页填充上一页放不下的关键过程控制记录
                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        strHtmlTable += common.SetSpecKeyQualityControl(dr["specid"].ToString(), dr["reportid"].ToString(), checkerNoEdit, dtSpecCheckPoints, dtSpecResource, dr);
                        currentRowsCount += (7 + processCount + designCount);
                    }
                }
                else
                {
                    //MAX_ROW_COUNT - 2 ==> 总行数 - 预留给条码区的2行高度
                    if (currentRowsCount + 1 <= MAX_ROW_COUNT - 2)
                    {
                        //第1页能放下当前普通工序
                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        currentRowsCount += 1;
                    }
                    else
                    {
                        //第1页放不下普通工序
                        pageNum += 1;
                        pageCount += 1;

                        //分页之前添加首页条码（2行）
                        strHtmlTable += "<div class='code'><div class='containerid'>*" + containerid + "*</div><div class='mfgorder'>*" + mfgordername + "*</div></div>";
                        strHtmlTable += "<div style='width:700px;height:0px;margin-bottom:0px;PAGE-BREAK-AFTER:always;'></div>";

                        //下一页添加分页（1行）
                        strHtmlTable += "<div class='pager' style='border-bottom:1px solid blue;'>第&nbsp;" + pageNum + "&nbsp;页，共&nbsp;1&nbsp;页</div>";
                        currentRowsCount = 1;

                        //在下一页填充上一页放不下的普通工序
                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        currentRowsCount += 1;
                    }

                }
            }
            else //第2页及以后
            {
                if (dr["isSpotCheck"].ToString() == "1")
                {
                    int processCount, designCount;
                    if (checkerNoEdit)
                    {
                        processCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '3'", dr["specid"].ToString())).Length;
                        designCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '4'", dr["specid"].ToString())).Length;
                    }
                    else
                    {
                        processCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '3' and containerstepworkreportid = '{1}'",
                            dr["specid"].ToString(), dr["reportid"].ToString())).Length;
                        designCount = dtSpecCheckPoints.Select(String.Format("specid='{0}' and checktype = '4' and containerstepworkreportid = '{1}'",
                            dr["specid"].ToString(), dr["reportid"].ToString())).Length;
                    }

                    //设计参数至少显示1行，没有则显示空行
                    processCount = processCount == 0 ? 1 : processCount;
                    //过程参数至少显示1行，没有则显示空行
                    designCount = designCount == 0 ? 1 : designCount;

                    //第2页及以后不用考虑条码占据的高度
                    if ((currentRowsCount + 7 + processCount + designCount) <= MAX_ROW_COUNT)
                    {
                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        strHtmlTable += common.SetSpecKeyQualityControl(dr["specid"].ToString(), dr["reportid"].ToString(), checkerNoEdit, dtSpecCheckPoints, dtSpecResource, dr);
                        currentRowsCount += (7 + processCount + designCount);
                    }
                    else
                    {
                        //填充空行
                        for (int i = 0; i < (MAX_ROW_COUNT - currentRowsCount) + 3; i++)
                        {
                            DataTable dt = dtSpecs.Clone();
                            strHtmlTable += SetSpecTableRow(dt.NewRow(), dtContainerMainInfo);
                        }

                        pageNum += 1;
                        pageCount += 1;

                        strHtmlTable += "<div style='width:700px;height:0px;margin-bottom:0px;PAGE-BREAK-AFTER:always;'></div>";
                        strHtmlTable += "<div class='pager' style='border-bottom:1px solid blue;'>第&nbsp;" + pageNum + "&nbsp;页，共&nbsp;1&nbsp;页</div>";
                        currentRowsCount = 1;

                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        strHtmlTable += common.SetSpecKeyQualityControl(dr["specid"].ToString(), dr["reportid"].ToString(), checkerNoEdit, dtSpecCheckPoints, dtSpecResource, dr);
                        currentRowsCount += (7 + processCount + designCount);
                    }
                }
                else
                {
                    //填充空行
                    if (currentRowsCount + 1 < MAX_ROW_COUNT + 4)
                    {
                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        currentRowsCount += 1;
                    }
                    else
                    {
                        pageNum += 1;
                        pageCount += 1;

                        strHtmlTable += "<div style='width:700px;height:0px;margin-bottom:0px;PAGE-BREAK-AFTER:always;'></div>";
                        strHtmlTable += "<div class='pager' style='border-bottom:1px solid blue;'>第&nbsp;" + pageNum + "&nbsp;页，共&nbsp;1&nbsp;页</div>";
                        currentRowsCount = 1;

                        strHtmlTable += SetSpecTableRow(dr, dtContainerMainInfo);
                        currentRowsCount += 1;
                    }
                }

            }

        }

        //只有1页，且未填满时
        if (pageCount == 1 && currentRowsCount <= MAX_ROW_COUNT - 2)
        {
            //只有1页，且未填满时，补充空行
            for (int i = 0; i < (MAX_ROW_COUNT - currentRowsCount - 2); i++)
            {
                strHtmlTable += SetSpecTableRow(dtSpecs.Clone().NewRow(), dtContainerMainInfo);
            }
            //分页之前，往首页底部添加条码（2行）
            strHtmlTable += "<div class='code'><div class='containerid'>*" + containerid + "*</div><div class='mfgorder'>*" + mfgordername + "*</div></div>";
            strHtmlTable += "<div style='width:700px;height:0px;margin-bottom:0px;PAGE-BREAK-AFTER:always;'></div>";
            currentRowsCount = 0;
        }

        //最后一页没有填满时
        if (pageCount > 1 && currentRowsCount < MAX_ROW_COUNT)
        {
            //补充空行
            for (int i = 0; i <= (MAX_ROW_COUNT - currentRowsCount) + 2; i++)
            {
                DataTable dt = dtSpecs.Clone();
                strHtmlTable += SetSpecTableRow(dt.NewRow(), dtContainerMainInfo);
            }
            strHtmlTable += "<div style='width:700px;height:0px;margin-bottom:0px;PAGE-BREAK-AFTER:always;'></div>";
            pageNum = 1;
            currentRowsCount = 0;
        }

        //批量打印，页数为奇数时，增加空白页
        if (containerCount >= 2 && (pageCount % 2 != 0))
        {
            strHtmlTable += "<div style='width:700px;height:0px;margin-bottom:10px;PAGE-BREAK-AFTER:always;'></div>";
        }
        #endregion

        strHtmlTable = strHtmlTable.Replace("共&nbsp;1&nbsp;页", "共&nbsp;" + pageCount + "&nbsp;页");

        return strHtmlTable;
    }

    //生成主要信息表格
    private string SetTableMain(DataTable dtMain)
    {
        string process_No = dtMain.Rows.Count > 0 ? dtMain.Rows[0]["Process_No"].ToString() : "";//工艺规程编号
        if (process_No.Contains("CZ"))
        {
            process_No = process_No.Replace("CZ", "");
        }
        string tableMain = string.Format("" +
        "<div id='title' class='title'>先锋批记录卡</div>" +
        "<!-- 先锋批主要信息 -->" +
        "<table class='tableMain'>" +
            "<tr>" +
                "<td class='col-1'>设计图版次</td>" +
                "<td class='col-2'>{0}</td>" +
                "<td class='col-3'>热处理批次号</td>" +
                "<td>{1}</td>" +
            "</tr>" +
            "<tr>" +
                "<td class='col-1'>工艺规程版次</td>" +
                "<td class='col-2'>{2}</td>" +
                "<td class='col-3'>零件图号</td>" +
                "<td>{3}</td>" +
            "</tr>" +
            "<tr>" +
                "<td class='col-1'>工艺规程编号</td>" +
                "<td class='col-2'>{4}</td>" +
                "<td class='col-3'>批次编号</td>" +
                "<td>{5}</td>" +
            "</tr>" +
            "<tr>" +
                "<td class='col-1'>生产订单</td>" +
                "<td class='col-2'>{6}</td>" +
                "<td class='col-3'>数量</td>" +
                "<td>{7}</td>" +
            "</tr>" +
            "<tr>" +
                "<td class='col-1'>批次顺序号</td>" +
                "<td colspan='3'>{8}</td>" +
            "</tr>" +
        "</table>",
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["Part_RevID"] : "", //设计图版次
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["YpHeatNo"] : "",//热处理批次号
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["ly2sequence"] : "", //工艺规程版次
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["productname"] : "",//零件图号
        process_No, //工艺规程编号
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["YpContainerNo"] : "",//批次编号
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["mfgordername"] : "", //生产订单
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["qty"] : "",//数量
        dtMain.Rows.Count > 0 ? dtMain.Rows[0]["childContainerNo"] : "");//批次顺序号
        return tableMain;
    }

    //生成工序表头
    private string SetSpecTableTitle()
    {
        string SpecTableTitle = string.Format("" +
        "<!-- 工序表头 -->" +
        "<table class='table'>" +
            "<tr>" +
                "<td class='row-1' rowspan='2' style='width:40px;'>工序号</td>" +
                "<td class='row-1' rowspan='2' style='width:119px;'>工序名称</td>" +
                "<td class='row-1' rowspan='2' style='width:35px;'>数量</td>" +
                "<td class='row-1' rowspan='2' style='width:60px;'>操作者</td>" +
                "<td class='row-1' rowspan='2' style='width:80px;'>日期</td>" +
                "<td class='row-1' colspan='4'>检验结果</td>" +
                "<td class='row-1' rowspan='2' style='width:50px;'>首件批次号</td>" +
                "<td class='row-1' rowspan='2' style='width:50px;'>检验印</td>" +
                "<td class='row-1' rowspan='2' style='width:50px;'>报废顺序号</td>" +
                "<td class='row-1' rowspan='2'>备注</td>" +
            "</tr>" +
            "<tr>" +
                "<td style='width:30px;'>合格</td>" +
                "<td style='width:30px;'>报废</td>" +
                "<td style='width:30px;'>返修</td>" +
                "<td style='width:30px;'>超差</td>" +
            "</tr>" +
        "</table>");
        return SpecTableTitle;
    }

    //生成工序行
    private string SetSpecTableRow(DataRow row, DataTable dtMain)
    {
        string containerId = dtMain.Rows[0]["containerId"].ToString();
        // 工序增加显示备注信息 add zhunan 2022.1.19
        string notes = "";
        if (dtContainerStepAttributes.Rows.Count > 0)
        {
            DataRow[] drs = dtContainerStepAttributes.Select(string.Format("workflowstepid='{0}'", row["workflowstepid"].ToString()));
            foreach (DataRow item in drs)
            {
                notes += item["notes"].ToString() + ",";
            }
        }
        //工人备注 add zhangrj 2022-07-19
        notes += string.IsNullOrWhiteSpace(row["worknote"].ToString()) ? "" : row["worknote"].ToString() + ",";
        //检验备注 add zhangrj 2022-10-29
        notes += string.IsNullOrWhiteSpace(row["checknote"].ToString()) ? "" : row["checknote"].ToString() + ",";
        //追加子批次信息 add zhangrj 2022-10-29
        if (dtContainerSubInfo.Rows.Count > 0)
        {
            DataRow[] rows = dtContainerSubInfo.Select(string.Format("workflowstepid='{0}'", row["workflowstepid"].ToString()));
            foreach (DataRow item in rows)
            {
                notes += item["rbtogetherflag"].ToString() + ",";
            }
        }
        ////备注追加工序检验备注信息  add zhangrj 2022-04-24
        //if (dtContainerStepCheckNotes.Rows.Count > 0)
        //{
        //    DataRow[] rows = dtContainerStepCheckNotes.Select(string.Format("workflowstepid='{0}'", row["workflowstepid"].ToString()));
        //    foreach (DataRow item in rows)
        //    {
        //        notes += item["checknote"].ToString() + ",";
        //    }
        //}
        if (row["controlcode"].ToString() == "LY05" || row["ISCOMMISSION"].ToString() == "1")//如果是外委
        {
            notes += "外委加工";
        }
        notes = notes.TrimEnd(',');
        string firstcheckcontainerno = "";
        if (!isBlank)
        {
            if (!string.IsNullOrWhiteSpace(row["ReportQty"].ToString()) && string.IsNullOrWhiteSpace(row["firstcheckcontainerno"].ToString()))
            {
                firstcheckcontainerno = "<div class='underLine' style='width: 30px;margin-left:10px'></div>";//如果报工了但没有首件批次号，则显示横线
            }
            else
            {
                firstcheckcontainerno = row["firstcheckcontainerno"].ToString().Replace(dtMain.Rows[0]["productname"].ToString() + "/", "");
            }
        }
        string specno = row["isSpotCheck"].ToString() == "1" ? "G" : "";//如果是关键工序，则在工序号前加G
        specno += row["specno"].ToString();
        string reportEmployeeName = string.Empty;//加工人
        string checkemployeeName = string.Empty;//检验员
        if (!isBlank)
        {
            //如果是检验序或者外委序，则显示横线，否则显示操作者
            reportEmployeeName = row["lastcheck"].ToString() == "1" || row["controlcode"].ToString() == "LY05"
                ? "<div class='underLine' style='width: 40px;margin-left:10px'></div>" : row["ReportEmployeeName"].ToString();
            //如果是外委序，则显示横线，否则显示检验员
            checkemployeeName = row["controlcode"].ToString() == "LY05"
                ? "<div class='underLine' style='width: 30px;margin-left:10px'></div>" : row["checkemployeename"].ToString();
        }
        string specRow = string.Format("" +
            "<table class='table'>" +
                "<tr>" +
                    "<td class='row-1' style='width:40px;'>{0}</td>" +//工序号
                    "<td class='row-1' style='width:119px;'>{1}</td>" +//工序名称
                    "<td class='row-1' style='width:35px;'>{2}</td>" +//数量
                    "<td class='row-1' style='width:60px;'>{3}</td>" +//报工人
                    "<td class='row-1' style='width:80px;'>{4}</td>" +//日期
                    "<td class='row-1' style='width:30px;'>{5}</td>" +//合格数
                    "<td class='row-1' style='width:30px;'>{6}</td>" +//报废数
                    "<td class='row-1' style='width:30px;'>{7}</td>" +//返修数
                    "<td class='row-1' style='width:30px;'>{8}</td>" +//超差数
                    "<td class='row-1' style='width:50px;'>{9}</td>" +//首件批次号
                    "<td class='row-1' style='width:50px;'>{10}</td>" +//检验员
                    "<td class='row-1' style='width:50px;'>{11}</td>" +//报废顺序号
                    "<td class='row-1' style='{12}'>{13}</td>" +//备注
                "</tr>" +
             "</table>",
             specno, //工序号
             row["opdesc"].ToString(),//工序名称
             isBlank ? "" : row["ReportQty"].ToString(),//数量
             reportEmployeeName,//报工人
             isBlank == false && row["reportdate"].ToString().IndexOf(' ') != -1 ? row["reportdate"].ToString().Split(' ')[0] : "",//报工日期
             isBlank || row["passqty"].ToString() == "0" ? "" : row["passqty"].ToString(),//合格数
             isBlank || row["lossqty"].ToString() == "0" ? "" : row["lossqty"].ToString(),//报废数
             isBlank || row["reworkqty"].ToString() == "0" ? "" : row["reworkqty"].ToString(),//返修数
             isBlank || row["defectqty"].ToString() == "0" ? "" : row["defectqty"].ToString(),//超差数
             firstcheckcontainerno,//首件批次号
             checkemployeeName,//检验员
             isBlank ? "" : "",//报废顺序号
             (notes != "" && notes.Length > 11) ? "text-align:left;font-size:10px;" : "",
             isBlank ? "" : notes//备注
             );
        return specRow;
    }
    #endregion
}